<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
 ! Excerpted from "Mastering Dojo",
 ! published by The Pragmatic Bookshelf.
 ! Copyrights apply to this code. It may not be used to create training material, 
 ! courses, books, articles, and the like. Contact us if you are in doubt.
 ! We make no guarantees that this code is fit for any purpose. 
 ! Visit http://www.pragmaticprogrammer.com/titles/rgdojo for more book information.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Slot Machine</title>
    <style type="text/css">
        @import "/dojoroot/dijit/themes/tundra/tundra.css";
        @import "/dojoroot/dojo/resources/dojo.css"
    </style>
    <script type="text/javascript" src="/dojoroot/dojo/dojo.js"  djConfig="parseOnLoad: true"></script>
    <script type="text/javascript">
       dojo.require("dojo.parser");
       dojo.require("dijit.layout.ContentPane");
       dojo.require("dijit.form.Button");
       dojo.require("dijit.form.CheckBox");
       dojo.require("dijit.form.NumberSpinner");
    </script>
</head>
<body class="tundra" >


<div dojoType="dijit.layout.ContentPane" 
     style="width:100px;height:200px;float:left"
     id="slot1">
    <div dojoType="dijit.form.Button">
       cherry
    </div>
</div>

<div dojoType="dijit.layout.ContentPane" 
     style="width:100px;height:200px;float:left"
     id="slot2">
    <div dojoType="dijit.form.Button">
       cherry
    </div>
</div>

<div dojoType="dijit.layout.ContentPane" 
     style="width:100px;height:200px;float:left"
     id="slot3">
    <div dojoType="dijit.form.Button">
       bar
    </div>
</div>



<div dojoType="dijit.form.Button">
   Pull Arm
   <script type="dojo/method" event="onClick">
       var slotValues=["cherry", "lemon", "orange", "bar", "seven"];
       function randomSlotButton() {
           var thisSlot = slotValues[Math.floor(Math.random()*5)];
           return "<div dojoType='dijit.form.Button'>" + thisSlot + "</div>";
       }
       dijit.byId("slot1").setContent(randomSlotButton());
       dijit.byId("slot2").setContent(randomSlotButton());
       dijit.byId("slot3").setContent(randomSlotButton());
   </script>
</div>



<div dojoType="dijit.form.Button">
   Pull Arm Remotely
   <script type="dojo/method" event="onClick">
       //var includeUrl="spinner-try1.html";
       // This one works:
       var includeUrl="spinner-try2.html";
       dijit.byId("slot1").setHref(includeUrl);
       dijit.byId("slot2").setHref(includeUrl);
       dijit.byId("slot3").setHref(includeUrl);
   </script>
</div>


</body>

